<?xml version="1.0" encoding="UTF-8"?>
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd">
    <namespaces>
        <Namespace>
            <prefix>st_${GML_PREFIX}</prefix>
            <uri>http://www.stations_${GML_PREFIX}.org/1.0</uri>
        </Namespace>
        <Namespace>
            <prefix>xlink</prefix>
            <uri>http://www.w3.org/1999/xlink</uri>
        </Namespace>
    </namespaces>
    <sourceDataStores>
        <DataStore>
            <id>stations_${GML_PREFIX}</id>
            <parameters>
                <Parameter>
                    <name>directory</name>
                    <value>file:./</value>
                </Parameter>
            </parameters>
        </DataStore>
    </sourceDataStores>
    <targetTypes>
        <FeatureType>
            <schemaUri>stations_${GML_PREFIX}.xsd</schemaUri>
        </FeatureType>
    </targetTypes>
    <includedTypes>
        <Include>measurements_${GML_PREFIX}.xml</Include>
    </includedTypes>
    <typeMappings>
        <FeatureTypeMapping>
            <sourceDataStore>stations_${GML_PREFIX}</sourceDataStore>
            <sourceType>stations_${GML_PREFIX}</sourceType>
            <targetElement>st_${GML_PREFIX}:Station_${GML_PREFIX}</targetElement>
            <attributeMappings>
                <AttributeMapping>
                    <targetAttribute>st_${GML_PREFIX}:Station_${GML_PREFIX}</targetAttribute>
                    <idExpression>
                        <OCQL>ID</OCQL>
                    </idExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st_${GML_PREFIX}:name</targetAttribute>
                    <sourceExpression>
                        <OCQL>NAME</OCQL>
                    </sourceExpression>
                    <ClientProperty>
                        <name>code</name>
                        <value>CODE</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st_${GML_PREFIX}:contact/st_${GML_PREFIX}:phone</targetAttribute>
                    <sourceExpression>
                        <OCQL>PHONE</OCQL>
                    </sourceExpression>
                    <encodeIfEmpty>true</encodeIfEmpty>
                    <ClientProperty>
                        <name>timeZone</name>
                        <value>TIMEZONE</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st_${GML_PREFIX}:contact</targetAttribute>
                    <ClientProperty>
                        <name>mail</name>
                        <value>MAIL</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st_${GML_PREFIX}:location</targetAttribute>
                    <sourceExpression>
                        <OCQL>LOCATION</OCQL>
                    </sourceExpression>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st_${GML_PREFIX}:measurements</targetAttribute>
                    <sourceExpression>
                        <OCQL>ID</OCQL>
                        <linkElement>st_${GML_PREFIX}:Measurement_${GML_PREFIX}</linkElement>
                        <linkField>FEATURE_LINK[1]</linkField>
                    </sourceExpression>
                    <ClientProperty>
                        <name>xlink:href</name>
                        <value>strConcat('http://www.stations.org/', ID)</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st_${GML_PREFIX}:featureLinkA</targetAttribute>
                    <ClientProperty>
                        <name>xlink:role</name>
                        <value>'http://www.geosciml.org/geosciml/2.0/doc/GeoSciML/GeologicUnit/GeologicUnit.html'</value>
                    </ClientProperty>
                    <ClientProperty>
                        <name>xlink:href</name>
                        <value>'http://www.geoserver.org/featureA'</value>
                    </ClientProperty>
                    <ClientProperty>
                        <name>xlink:title</name>
                        <value>'The A feature'</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st_${GML_PREFIX}:featureLinkB</targetAttribute>
                    <ClientProperty>
                        <name>xlink:role</name>
                        <value>'http://www.geosciml.org/geosciml/2.0/doc/GeoSciML/GeologicUnit/GeologicUnit.html'</value>
                    </ClientProperty>
                    <ClientProperty>
                        <name>xlink:href</name>
                        <value>'http://www.geoserver.org/featureB'</value>
                    </ClientProperty>
                    <ClientProperty>
                        <name>xlink:title</name>
                        <value>'The B feature'</value>
                    </ClientProperty>
                </AttributeMapping>
                <AttributeMapping>
                    <targetAttribute>st_${GML_PREFIX}:featureLinkC</targetAttribute>
                    <ClientProperty>
                        <name>xlink:role</name>
                        <value>'http://www.geosciml.org/geosciml/2.0/doc/GeoSciML/GeologicUnit/GeologicUnit.html'</value>
                    </ClientProperty>
                    <ClientProperty>
                        <name>xlink:href</name>
                        <value>'http://www.geoserver.org/featureC'</value>
                    </ClientProperty>
                    <ClientProperty>
                        <name>xlink:title</name>
                        <value>'The C feature'</value>
                    </ClientProperty>
                </AttributeMapping>
            </attributeMappings>
        </FeatureTypeMapping>
    </typeMappings>
</as:AppSchemaDataAccess>